#define _CRT_SECURE_NO_WARNINGS
#include "1.23_hs.h"
int add(int x, int y)
{
	return x + y;
}

int sub(int x, int y)
{
	return x - y;
}

int mul(int x, int y)
{
	return x * y;
}

int Div(int x, int y)
{
	return x / y;
}

int(*signal(int c, int(*p)(int, int)))(int, int)
{
	return p;
}

void test()
{
	//int n = 10;
	//int m = 20;
	//const int* p1 = &n;
	//int const* p2 = &m;
	///**p1 = 20;
	//*p2 = 10*/

	/*int n = 10;
	int m = 20;
	int* const p = &n;
	*p = m;
	p = &m;*/

	int n = 10;
	int m = 20;
	const int* const p1 = &n;
	int const* const p2 = &m;
	/*p1 = &m;
	p2 = &n;
	*p1 = m;
	*p2 = n;*/
}

int strlen_f(const char* p)
{
	const char* s = p;
	while (*p)
		p++;
	return p - s;
}

int strlen_s(const char* p)
{
	int count = 0;
	while (*p)
	{
		count++;
		p++;
	}
	return count;
}

int strlen_t(const char* p)
{
	if (!*p)
		return 0;
	return 1 + strlen_t(++p);
}

char* m_strcpy(char* p1, const char* p2)
{
	char* const ret = p1;
	while (*p2)
		*p1++ = *p2++;
	*p1 = *p2;
	return ret;
}

char* m_strcat(char* p1, const char* p2)
{
	char* const ret = p1;
	while (*++p1)
		;
	while (*p2)
		*p1++ = *p2++;
	*p1 = *p2;
	return ret;
}

void Print_emp(struct emp sz[], int st)
{
	for (int i = 0; i < st; i++)
		printf("%s %d\n", sz[i].name, sz[i].age);
}

int cmp_name(const void* e1, const void* e2)
{
	return strcmp(((struct emp*)e1)->name, ((struct emp*)e2)->name);
}